<?php
include("../../inc/global.inc");
include("../islogin.php");
if($_POST[act]){
	    $c_rs=@mysql_query("select * from city where id='$_POST[c_provinces]' and city_id=0");
		$c_row=@mysql_fetch_array($c_rs);
		$c_rs2=@mysql_query("select * from city where id='$_POST[c_city]' and city_id>0");
		$c_row2=@mysql_fetch_array($c_rs2);
		$c_rs3=@mysql_query("select * from city where id='$_POST[c_diqu]' and city_id>0");
		$c_row3=@mysql_fetch_array($c_rs3);
        $m_diqu=($_POST[c_diqu])?$_POST[c_diqu]:0;
		
mysql_query("update member set  m_pro='$_POST[c_provinces]',m_city='$_POST[c_city]',m_diqu='$m_diqu',pro='$c_row[city_name]',city='$c_row2[city_name]',diqu='$c_row3[city_name]',m_sex='$_POST[m_sex]',m_name='$_POST[m_name]',m_addre='$_POST[m_addre]',m_qq='$_POST[m_qq]',m_tel='$_POST[m_tel]',m_phone='$_POST[m_phone]',m_email='$_POST[m_email]',m_zip='$_POST[m_zip]',m_cl='0' where id='".$_COOKIE['user_id']."'");

echo "<script>alert('提交成功');location='member-info.php';</script>";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心-三帝贸易网</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../js/left.js" charset="gb2312"></script>
<script language="javascript" src="/js/city.js" type="text/javascript" charset="gb2312"></script>
<body>
<div id="mian">
<?php include("../inc/top.php");?>
<div class="top1"><span>您当前位置：<a href="../index.php" class="dh">会员助手</a> &gt;&gt; 企业商铺管理 &gt;&gt; 会员信息</span></div>
<div class="left">
<?php include("../inc/left.php");?>
</div>
<div class="right">
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
   <TR>
     <TD height="40" bgcolor="#EFF6FF" style="font-size:18px;font-weight:bold;padding-left:8px;">会员信息</TD>
   </TR>
</TABLE>
<br>
    <?php
	$rs=mysql_query("select * from member where id='".$_COOKIE['user_id']."'");
	$row=mysql_fetch_array($rs);
	?>
      <TABLE width="100%" border="0" cellPadding="0" cellSpacing="0" bgcolor="#EEEEEE">
        <TR>
          <TD bgcolor="#FFFFFF">
            <TABLE width="100%" border="0" cellpadding="0" cellSpacing="1" bgcolor="#C1DCF5">
              <TBODY><form method="post" action="" name="form1" onSubmit="return check()">
			  <TR>
                  <td height="30" align="center" bgcolor="#EFF6FF">联系人姓名</td>
                  <TD bgcolor="#F9F9F9" style="padding-left:3px;"><input name="m_name" type="text" value="<?=$row['m_name']?>" size="20" maxlength="30" /></TD>
                </TR>
                <TR>
                  <td width="26%" height="30" align="center" bgcolor="#EFF6FF">联系人称呼</td>
                  <TD width="74%" bgcolor="#F9F9F9" style="padding-left:3px;">
		    <select name="m_sex">
              <option value="先生" <?php if($row['m_sex']=="先生"){echo "selected";}?>>先生</option>
              <option value="女士" <?php if($row['m_sex']=="女士"){echo "selected";}?>>女士</option>
              <option value="小姐" <?php if($row['m_sex']=="小姐"){echo "selected";}?>>小姐</option>
            </select></TD>
                </TR>
               <tr>
                  <td height="30" align="center" bgcolor="#EFF6FF" ><span class="text">省份-城市-地区</span></td>
        <td colspan="2" bgcolor="#F9F9F9" style="padding-left:3px;">
		<select name="c_provinces" onChange="changecity(document.form1.c_provinces.options[document.form1.c_provinces.selectedIndex].value)">
<option value="">--选择省份--</option>    
<?    
$rs01=@mysql_query("select * from city where city_id=0 order by order_name asc");    
while($res=@mysql_fetch_array($rs01)){    
?>    
<option value="<?=$res['id']?>" <?php if($row['m_pro']==$res['id']){echo "selected";}?>><?=$res['city_name']?></option> 
<? } ?>    
</select>     
<select name="c_city" id="c_city"  onChange="changecity2(document.form1.c_city.options[document.form1.c_city.selectedIndex].value)">                    
  <option value="">--选择城市--</option>
  			<?php
			$rs2=mysql_query("select * from city where city_id=".$row['m_pro']." order by id asc");
			while($row2=mysql_fetch_array($rs2)){
			?>
			<option value="<?=$row2['id']?>" <?php if($row['m_city']==$row2['id']){echo "selected";}?>><?=$row2['city_name']?></option>
			<?php
			}?>  
</select>
	   <select name="c_diqu" id="c_diqu">
            <option value="">--选择地区--</option>
			<?php
			$rs3=mysql_query("select * from city where city_id=".$row['m_city']." order by id asc");
			while($row3=mysql_fetch_array($rs3)){
			?>
			<option value="<?=$row3['id']?>" <?php if($row['m_diqu']==$row3['id']){echo "selected";}?>><?=$row3[city_name]?></option>
			<?php
			}?> 
       </select></td>
              </tr>
                <tr>
                  <td align="center" bgcolor="#EFF6FF" height="25">联系地址</td>
                  <td bgcolor="#F9F9F9" style="padding-left:3px;"><input name="m_addre" type="text" value="<?=$row['m_addre']?>" size="50"></td>
                </tr>
                <TR>
                  <td height="30" align="center" bgcolor="#EFF6FF">联系人邮箱</td>
                  <TD bgcolor="#F9F9F9" style="padding-left:3px;"><input name="m_email" type="text" value="<?=$row['m_email']?>" size="35" maxlength="150" /></TD>
                </TR>

				<TR>
                  <td height="25" align="center" bgcolor="#EFF6FF">即时通</td>
                  <TD bgcolor="#F9F9F9" style="padding-left:3px;"><input name="m_qq" type="text" value="<?=$row['m_qq']?>" size="35" maxlength="100" />
                    （qq或msn）</TD>
                </TR>
                <tr>
                  <td height="25" align="center" bgcolor="#EFF6FF">联系电话</td>
                  <td bgcolor="#F9F9F9" style="padding-left:3px;"><input name="m_tel" type="text" value="<?=$row['m_tel']?>" size="20"/></td>
                </tr>
                <tr>
                  <td height="25" align="center" bgcolor="#EFF6FF">联系手机</td>
                  <td bgcolor="#F9F9F9" style="padding-left:3px;"><input name="m_phone" type="text" value="<?=$row['m_phone']?>" size="20"></td>
                </tr>
                <tr>
                  <td height="25" align="center" bgcolor="#EFF6FF">邮编</td>
                  <td bgcolor="#F9F9F9" style="padding-left:3px;"><input name="m_zip" type="text" size="8" maxlength="10" value="<?=$row['m_zip']?>"></td>
                </tr>
				<TR>
                  <td height="30" align="center" bgcolor="#EFF6FF">最后登录时间</td>
                  <TD bgcolor="#F9F9F9" style="padding-left:3px;"><?=date("Y-m-d",strtotime($row['m_logintime']))?></TD>
                </TR>
				<TR>
                  <td height="30" align="center" bgcolor="#EFF6FF">会员注册时间</td>
                  <TD bgcolor="#F9F9F9" style="padding-left:3px;"><?=date("Y-m-d",strtotime($row[m_addtime]))?></TD>
                </TR>
                <TR>
                  <td height="30" align="center" bgcolor="#EFF6FF">&nbsp;</td>
                  <TD bgcolor="#F9F9F9"><input type="submit" value=" 提 交 ">
                  <input type="hidden" name="act" value="ok"></TD>
                </TR></form>
              </TBODY>
          </TABLE></TD>
        </TR>
      </TABLE>
</div>
<div class="onl"></div>
<?php include("../inc/foot.php");?>
</div>
</body>
</html>
<script language="javascript">
function $(id){
return document.getElementById(id);
}
function check(){
if($("c_provinces").value==""){
alert("请选择省份");
$("c_provinces").focus();
return false;
}
if($("c_city").value==""){
alert("请选择城市");
$("c_city").focus();
return false;
}
var pattern = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
　　　　if(!pattern.test($("m_email").value)){
			alert("请输入您的E-mail地址");
			$("m_email").focus();
			return false;
		}

}
</script>